/**
 * 
 */
package net.toocruel.iqismart.entity.user;

import net.toocruel.iqismart.entity.base.BaseEntity;
import net.toocruel.iqismart.entity.common.Area;
import net.toocruel.iqismart.entity.constants.Gender;
import net.toocruel.iqismart.entity.rbac.User;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

/**
 * 用户信息
 *
 * @author toocruel
 */
@Entity
public class UserDetail extends BaseEntity {

	private static final long serialVersionUID = 2537036287594063316L;
	@Enumerated(EnumType.ORDINAL)
	private Gender gender = Gender.PRIVATE;
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	private Date birthday;

	@ManyToOne(cascade = CascadeType.DETACH)
	@JoinColumn(name = "provinceId")
	private Area province;

	@ManyToOne(cascade = CascadeType.DETACH)
	@JoinColumn(name = "cityId")
	private Area city;

	public UserDetail() {
	}

	private String title;

	private String qrcode;

	private String description;

    public UserDetail(User user) {
        super();
    }



	public Gender getGender() {
		return gender;
	}

	public void setGender(Gender gender) {
		this.gender = gender;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public Area getProvince() {
		return province;
	}

	public void setProvince(Area province) {
		this.province = province;
	}

	public Area getCity() {
		return city;
	}

	public void setCity(Area city) {
		this.city = city;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getQrcode() {
		return qrcode;
	}

	public void setQrcode(String qrcode) {
		this.qrcode = qrcode;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}


	@Override
	public String toString() {
		return "UserDetail{" +
				"gender=" + gender +
				", birthday=" + birthday +
				", province=" + province +
				", city=" + city +
				", title='" + title + '\'' +
				", qrcode='" + qrcode + '\'' +
				", description='" + description + '\'' +
				'}';
	}
}
